
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>新增部门</title>

    <link href="resources/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet" />
    <link href="resources/plugins/material-design-iconic-font-2.2.0/css/material-design-iconic-font.min.css" rel="stylesheet" />
    <link href="resources/plugins/bootstrap-table-1.11.0/bootstrap-table.min.css" rel="stylesheet" />
    <link href="resources/plugins/waves-0.7.5/waves.min.css" rel="stylesheet" />
    <link href="resources/plugins/jquery-confirm/jquery-confirm.min.css" rel="stylesheet" />
    <link href="resources/plugins/select2/css/select2.min.css" rel="stylesheet" />
    <script src="resources/plugins/select2/js/select2.min.js"></script>
    <link href="resources/css/common.css" rel="stylesheet" />
</head>
<body>
<div style="padding: 30px 20%;">
    <p>
    <h4>输入部门基本信息</h4>
    <br>


    </p>
    <div id="createDialog" class="crudDialog">
        <form id="newForm" action="/web_design_war_exploded/DepartmentUpdate" method="post">

            <div class="form-group">
                <label for="dname" class="active">名称（必填）</label>
                <input id="dname"  name="dname" type="text" class="form-control">
            </div>
            <div class="form-group" hidden>
                <label for="dnum" class="active">名称（必填）</label>
                <input id="dnum"  name="dnum" type="text"  class="form-control">
            </div>

            <div class="form-group">
                <label for="phone" class="active">电话（必填）</label>
                <input id="phone" name="phone" type="text" class="form-control">
            </div>

            <div class="form-group">
                <label for="fax" class="active">传真</label>
                <input id="fax" type="text" name="fax" class="form-control">
            </div>

            <div class="form-group">
                <label for="des" class="active">描述</label>
                <input id="des" name="des" type="text" class="form-control">
            </div>

            <div class="form-group">
                <label for="parent" class="active">上级部门</label>
                <input id="parent" name="parent" type="text" class="form-control">
            </div>
            <div class="form-group">
                <label for="establishDate" class="active">成立时间（必填）</label>
                <input id="establishDate" name="establishDate" type="date" class="form-control">
            </div>

            <div class="form-group">
                <select class="form-control" name="type" id="type">
                    <option>(请选择类型)</option>
                    <option>公司</option>
                    <option>部门</option>
                </select>
            </div>


            <a class="waves-effect waves-button" href="javascript:;" onclick="Sure()"><i class="zmdi zmdi-seat"></i> 提交</a>


        </form>
    </div>

</div>

<script src="resources/plugins/jquery.1.12.4.min.js"></script>
<script src="resources/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
<script src="resources/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
<script src="resources/plugins/bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="resources/plugins/waves-0.7.5/waves.min.js"></script>
<script src="resources/plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="resources/plugins/select2/js/select2.min.js"></script>



<script src="resources/js/common.js"></script>

<script>

    var url=location.search;
    var theR=new Object();
    if(url.indexOf("?")!=-1){
        var str=url.substr(1);
        var strs=str.split("&");
        for(var i=0;i<strs.length;i++){
            theR[strs[i].split("=")[0]]=decodeURIComponent(strs[i].split("=")[1]);
            if(theR["dname"]==null){theR["dname"]=" ";}
            if(theR["type"]==null){theR["type"]=" ";}
            if(theR["phone"]==null){theR["phone"]=" ";}
            if(theR["fax"]==null){theR["fax"]=" ";}
            if(theR["des"]==null){theR["des"]=" ";}
            if(theR["parent"]==null){theR["parent"]=" ";}
            if(theR["establishDate"]==null){theR["establishDate"]=" ";}

            if(theR["dname"]=="undefined"){theR["dname"]=" ";}
            if(theR["type"]=="undefined"){theR["type"]=" ";}
            if(theR["phone"]=="undefined"){theR["phone"]=" ";}
            if(theR["fax"]=="undefined"){theR["fax"]=" ";}
            if(theR["des"]=="undefined"){theR["des"]=" ";}
            if(theR["parent"]=="undefined"){theR["parent"]=" ";}
            if(theR["establishDate"]=="undefined"){theR["establishDate"]=" ";}
        }
    }

    document.getElementById("dname").value=theR["dname"];
    document.getElementById("type").value=theR["type"];
    document.getElementById("fax").value=theR["fax"];
    document.getElementById("des").value=theR["des"];
    document.getElementById("parent").value=theR["parent"];
    document.getElementById("dname").value=theR["dname"];
    document.getElementById("establishDate").value=theR["establishDate"];
    document.getElementById("phone").value=theR["phone"];//ng-value

    console.log(theR);


</script>


<script>


    function Sure() {
        if(checkEmpty1()==0){
            return 0;
        }
        else{
            console.log(document.getElementById("newForm"))
            document.getElementById("newForm").submit();

        }
    }

    function checkEmpty1() {
        var dnum = $('#dnum').val();
        var dname = $('#dname').val();
        var type = $('#type').val();
        var phone = $('#phone').val();
        var des = $('#des').val();
        var parent = $('#parent').val();
        var establishDate = $('#establishDate').val();
        var fax = $('#fax').val();
        //consloe.log(dnum,dname,type,phone,des,parent,)
        if (dname == null || dname == ""|| type == null || type == ""|| phone == null || phone == ""|| establishDate == null || establishDate == "") {
            alert("有必填项还未填写！");
            return 0;
        }
        else{
            return 1;
        }
    }

</script>
<script src="resources/plugins/jquery.1.12.4.min.js"></script>
<script src="resources/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
<script src="resources/plugins/bootstrap-table-1.11.0/bootstrap-table.min.js"></script>
<script src="resources/plugins/bootstrap-table-1.11.0/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="resources/plugins/waves-0.7.5/waves.min.js"></script>
<script src="resources/plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="resources/plugins/select2/js/select2.min.js"></script>



<script src="resources/js/common.js"></script>

</body>
</html>

